home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
elan1v5.arc
/
DRAGON.ARC
/
DRAGPACK.E
< prev
next >
Wrap
Text File
|
1989-03-10
|
2KB
|
68 lines
PROC move (INT CONST dir):
x INCR dx [dir];
y INCR dy [dir];
move (round (x), round (y))
ENDPROC move;
PROC draw dragon (INT CONST day, cell):
IF day = 0
THEN draw cell (cell)
ELSE
INT VAR i;
FOR i FROM 1 UPTO children
REP
INT CONST next :: offsprings [cell + 1] [i];
IF next >= 0
THEN draw dragon (day - 1, next)
FI
ENDREP
FI
ENDPROC draw dragon;
PROC draw cell (INT CONST cell):
INT CONST b :: behavior [cell + 1] + 1;
IF b = 0
THEN
ELIF b <= directions
THEN draw (b)
ELSE move (b - directions)
FI
ENDPROC draw cell;
PROC draw (INT CONST dir):
x INCR dx [dir];
y INCR dy [dir];
draw (round (x), round (y))
ENDPROC draw;
start drawing:
init steps;
enter graphics mode;
move ((graphics x limit - length (dragon name) * character width) DIV 2, 1);
put (dragon name);
line (2);
TEXT CONST t :: "For details: Creating fractals; Byte, Aug.1987, pp.123.";
move ((graphics x limit - length (t) * character width) DIV 2, current y position);
put (t);
REAL VAR x :: real (start x), y :: real (start y);
move (start x, start y).
init steps:
ROW directions REAL VAR dx, dy;
INT VAR i;
REAL CONST s :: real (size of cell);
FOR i FROM 1 UPTO directions
REP
REAL CONST a :: 2.0 * pi * real (i - 1) / real (directions);
dx [i] := aspect * s * cos (a);
dy [i] := s * sin (a)
ENDREP.
finish drawing:
move (1, graphics y limit - line height);
put ("Hit any key!");
TEXT CONST wait :: inchar;
enter text mode.
⇦